<?php 
		namespace Admin\Model;
		use Think\Model\RelationModel;
		class AdverModel extends RelationModel	{
			protected $tableName = 'adver';
			protected $_link = array(       
					'adver_data' => array(   
							 'mapping_type'  => self::HAS_MANY,  
							  'class_name'    => 'adver_data',   
								 'foreign_key'   => 'id', 
							   'mapping_name'  => 'data', 
							   'mapping_order' => 'listorder desc',    // 定义更多的关联属性    ……
							   ),
												   );
			
			//查询一条数据
			public function getOne($id){
				return $this->relation(true)->find($id);
			}
		}


?>